package com.miplus.ccrm.sms;

import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @Author： Yaohui
 * @Date： 2024/12/2 15:32
 * @Describe：
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LineAPIR<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 0=Success，其它失败码
     */
    private Integer code;

    /**
     * 失败原因
     */
    private String message;

    /**
     * 成功的关联ID
     */
    private String refID;

    /**
     * 返回参数
     */
    private JSONObject jsonObject;

    public static <T> LineAPIR<T> Success(String r,JSONObject jsonObject)
    {
        LineAPIR<T> result=new LineAPIR<>();
        result.setCode(0);
        result.setMessage("SUCCESS");
        result.setRefID(r);
        result.setJsonObject(jsonObject);
        return result;
    }

    public static <T> LineAPIR<T> Error(Integer Code,String Message)
    {
        LineAPIR<T> result=new LineAPIR<>();
        result.setCode(Code);
        result.setMessage(Message);
        result.setRefID("");
        return result;
    }
}
